package main

import (
	/*
		框架
	*/
	"./API/RoutingManagement"
	/*
		用户路由
		ManagingResources	网站资源管理包
	*/
	"./Routing/ManagingResources"
	"./Routing/WebsiteFrontEnd"
)

// 全局入口
func main() {
	/*
		初始化
	*/
	RoutingManagement.InItRouting(":5000")
	//	// 初始化用户
	//	TheUserList := RoutingManagement.TheUserList
	//	TheUserList["e2e0061f251355de79777499528d6d75"] = RoutingManagement.Userinfo{
	//		Regdate:  123,
	//		Position: "e2e0061f251355de79777499528d6d75",
	//	}
	//	TheUserList["e2e0061f251355de79777499528d6d74"] = RoutingManagement.Userinfo{
	//		Possess:  true,
	//		Regdate:  222,
	//		Position: "e2e0061f251355de79777499528d6d74",
	//	}
	//	//-> 设定路由
	Access := RoutingManagement.Access
	//	/*
	//		用户路由
	//	*/
	//	// 普通用户
	//	Access[`^/User\?key=[a-fA-F0-9]{32,32}$`] = RoutingManagement.AccessClass{
	//		Privilege:    true,
	//		AccessMethod: true,
	//		HInheritance: ManagingResources.User,
	//	}
	//	// 会员
	//	Access[`^/Member\?key=[a-fA-F0-9]{32,32}$`] = RoutingManagement.AccessClass{
	//		Gmlevel:      true,
	//		Privilege:    true,
	//		AccessMethod: true,
	//		HInheritance: ManagingResources.Member,
	//	}
	//	/*
	//		资源API管理路由注册
	//	*/
	//	//	个人资源
	//	Access[`^/resource/(js|css|images)/[a-zA-Z0-9]+.(js|css|jpg|png|mp3)\?key=([a-fA-F0-9]{32,32})$`] = RoutingManagement.AccessClass{
	//		Privilege:    true,
	//		AccessMethod: true,
	//		HInheritance: ManagingResources.Personal,
	//	}
	//	共用资源
	Access[`^/common/(js|css|images|audio|video)/[a-zA-Z0-9]+.(js|css|jpg|png|mp3|mp4)$`] = RoutingManagement.AccessClass{
		AccessMethod: true,
		HInheritance: ManagingResources.Common,
	}
	//	网站路由注册
	Access[`^/[a-zA-Z0-9]+.html$`] = RoutingManagement.AccessClass{
		AccessMethod: true,
		HInheritance: WebsiteFrontEnd.HomePage,
	}
	//	/*
	//		管理员API路由注册
	//	*/
	//	Access["/Administrator/"] = RoutingManagement.AccessClass{
	//		Controller:   true,
	//		HInheritance: ManagingResources.Common,
	//	}
	/*
		启动服务器
	*/
	defer RoutingManagement.RunWebsite()
}
